package com.insigma.cisco.itc.tms.teammanagement.dao.daoImpl;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.insigma.cisco.itc.tms.common.domain.User;
import com.insigma.cisco.itc.tms.teammanagement.dao.LoginDao;

public class LoginDaoImpl extends HibernateDaoSupport implements LoginDao {

	@Override
	public User getUser(String username, String password) {
		if (getHibernateTemplate().find(
				"from User as u where u.username = " + "'" + username + "'"
						+ "and u.password = " + "'" + password + "'").size() == 0)
			return null;
		else {
			return (User) (getHibernateTemplate()
					.find("from User as u where u.username = " + "'" + username
							+ "'" + "and u.password = " + "'" + password + "'"))
					.get(0);
		}

	}
}
